package zad1;
import java.util.ArrayList;





public class Zad1test {

	public static void main(String[] args) {

		ArrayList<Workers> workers = new ArrayList<Workers>();

		workers.add(new Producer()); 

		for (int i = 0; i < 5; i++) {
			workers.add(new MiddleWorker(i));
		}

		workers.add(new Consumer());

		for (int i = 0; i < workers.size() - 1; i++) {
			workers.get(i).setNextWorkerId(workers.get(i + 1).getWorkId());
		}
		workers.get(workers.size() - 1).setNextWorkerId(
				workers.get(0).getWorkId());

		Buffor bufor = new Buffor(4);

		for (Workers coWorker : workers) {
			coWorker.setBufor(bufor);
			coWorker.start();
		}

	}

}
